import { $post, $put, $get } from '@js/request'
import { CaseSchema } from '@components/schema/caseSchema'

// 新增数据
export async function addRequest (d: { [k: string]: any }): Promise<void> {
  const res = await $post('/api/commission/case_dismissal', d)
  return res.data
}

// 修改数据
export async function updateRequest (d: { [k: string]: any }): Promise<void> {
  const id: string = d.id
  delete d.id
  const res = await $put(`/api/commission/case_dismissal/${id}`, d)
  return res.data
}

// 根据caseno_desc获取案件列表
export async function getCaseListRquesst (str: string): Promise<CaseSchema[]> {
  const res = await $get('/api/commission/case', {
    condition: JSON.stringify([{ k: 'caseno_desc', o: 'like', v: `%${str}%` }])
  })
  return res.data.list
}
